import axios from "../../utils/axios";
import api from "../../api";

export function freshList() {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.departmentSettings.GET_DEPARTEMNT_LIST,
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function addList(data) {
    console.log(data);
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.departmentSettings.NEW_DEPARTEMNT_LIST,
            data: { ...data },
            method: 'POST'
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function upList(data) {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.departmentSettings.UP_DEPARTEMNT_LIST,
            data,
            method: 'post'
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
export function delList(data) {
    return new Promise((reslove, reject) => {
        axios({
            url: api.StaffManage.departmentSettings.DEL_DEPARTEMNT_LIST,
            params: data,
            method: 'post'
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}